import request from "@/utils/request";

// 单位模块url
const UNITS_BASE_URL = "/admin";

const UnitsAPI = {
    /**
     * 获取单位列表
     * @param queryParams
     * @returns
     */
    getList(queryParams: any) {
        return request<any, any>({
            url: `${UNITS_BASE_URL}/company/list`,
            method: "get",
            params: queryParams,
        });
    },

    /**
     * 添加单位
     * @param
     * @returns
     */
    addUnits(params: any) {
        return request<any, any>({
            url: `${UNITS_BASE_URL}/company/add`,
            method: "post",
            params: params,
        });
    },

    /**
     * 获取单位详情
     * @param
     * @returns
     */
    getUnitsInfo(id: any) {
        return request<any, any>({
            url: `${UNITS_BASE_URL}/company/info`,
            method: "get",
            params: { id },
        });
    },

    /**
     * 编辑用户详情
     * @param
     * @returns
     */
    editUnitsInfo(params: any) {
        return request<any, any>({
            url: `${UNITS_BASE_URL}/company/edit`,
            method: "post",
            params: params,
        });
    },

    /**
     * 查看单位详情
     * @param
     * @returns
     */
    viewUnitsInfo(id: any) {
        return request<any, any>({
            url: `${UNITS_BASE_URL}/company/detail`,
            method: "get",
            params: id,
        });
    },

    /**
     * 修改单位编辑状态
     * @param
     * @returns
     */
    changeUnitsStatus(params: any) {
        return request<any, any>({
            url: `${UNITS_BASE_URL}/company/updateStatus`,
            method: "post",
            params: params,
        });
    },

    // ---------------------------------单位成员

    /**
     * 查看单位成员
     * @param
     * @returns
     */
    viewUnitsUserUser(params: any) {
        return request<any, any>({
            url: `${UNITS_BASE_URL}/company/companyUserList`,
            method: "get",
            params: params,
        });
    },

    /**
     * 查看单位成员列表
     * @param
     * @returns
     */
    getUnitsUserList(params: any) {
        return request<any, any>({
            url: `${UNITS_BASE_URL}/company/userList`,
            method: "get",
            params,
        });
    },
    /**
     * 添加单位成员
     * @param
     * @returns
     */
    addUnitsUserUser(params: any) {
        return request<any, any>({
            url: `${UNITS_BASE_URL}/company/addUser`,
            method: "post",
            params: params,
        });
    },
    /**
     * 编辑单位成员
     * @param
     * @returns
     */
    editUnitsUserUser(company_id: any) {
        return request<any, any>({
            url: `${UNITS_BASE_URL}/company/userSelected`,
            method: "get",
            params: { company_id },
        });
    },
};

export default UnitsAPI;
